package com.eliza.base.views.learn

import androidx.compose.runtime.Composable
import androidx.navigation.NamedNavArgument
import androidx.navigation.NavBackStackEntry
import androidx.navigation.NavController
import androidx.navigation.NavType
import androidx.navigation.navArgument
import com.eliza.base.viewrouter.NavLearnEnum
import com.eliza.library.ui.compose.NavRouteColumn


@Composable
fun LearnScreen(
    navController: NavController,
) {
    NavRouteColumn(navController = navController, entries = NavLearnEnum.entries)
}

data class LearnArg(val email: String, val vip: Boolean) {
    companion object {
        val route = "?email={email},vip={vip}"
        val arguments: MutableList<NamedNavArgument>
            get() = mutableListOf(
                navArgument("email") {
                    type = NavType.StringType
                    defaultValue = "empty"
                },
                navArgument("vip") {
                    type = NavType.BoolType
                    defaultValue = "empty"
                }
            )

        fun parse(back: NavBackStackEntry): LearnArg {
            return LearnArg(
                email = back.arguments?.getString("email") ?: "",
                vip = back.arguments?.getBoolean("vip") ?: false
            )
        }

        fun args(email: String, vip: Boolean): String {
            return "email=${email},vip=${vip}"
        }
    }

}
